package com.sunshine.ssm.multithreading;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Author: WeiHong
 * @Date: 2017/5/17 16:36
 */
public class TestApp {

    public static void main(String[] args) {
        Account account = new Account();
        ExecutorService service = Executors.newFixedThreadPool(10);
        for (int i = 0; i < 100; i++) {
            service.execute(new AddMoneyThread(account, 1));
        }
        service.shutdown();
        while (!service.isTerminated()) {
        }
        System.out.println("账户余额: " + account.getBalance());
    }
}
